<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>信息编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
<script type="text/javascript" src="scripts/jquery/jquery-1.4.4.min.js"></script>
<script src="scripts/My97DatePicker/WdatePicker.js" type="text/javascript" defer="defer"></script>
<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
<script type="text/javascript">
$(document).ready(function() {
	
	$("#submitbutton").click(function() {
		validateForm();
		parent.$.fancybox.close();
	});
	
	/*
	 * 提交
	 */
	/* $("#submitbutton").click(function() {
		if(validateForm()){
			 $("#submitForm").submit(); //提交
             parent.$.fancybox.close(); //关闭
			//checkFyFhSubmit();
		}
	}); */
	
	function checkFyFhSubmit(){
		// 分别获取学校信息
		var majorsid = $('#majorsid').val();//专业id
		var majors = $('#majors').val();//专业名称
		var employement_rate = $('#employement_rate').val();//录取率
		var majors_number = $('#majors_number').val();//录取人数
		if(majorsid!="" && majors!=""&&employement_rate!=""&&majors_number!=""){
			// 异步判断该信息是否存在
			$.ajax({
				type:"POST",
				url:"DoProvinceMessage?action=select",
				data:{"majorsid":majorsid,"majors":majors,'employement_rate':employement_rate,'majors_number':majors_number},
				dataType : "text",
				success:function(data){
// 					alert(data);
					// 如果返回数据不为空，更改“房源信息”
					{
						$("#submitForm").attr("action", "DoMajors?action=update").submit();
					}
				}
			});
		}
		return true;
	}
	/*
	 * 取消
	 */
	$("#cancelbutton").click(function() {
		/**  关闭弹出iframe  **/
		window.parent.$.fancybox.close();
	});
	
	var result = 'null';
	if(result =='success'){
		/**  关闭弹出iframe  **/
		window.parent.$.fancybox.close();
	}
});
	
	/** 表单验证  **/
	function validateForm(){
		if($("#majors").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写专业名称', ok:true,});
			return false;
		}
		if($("#employement_rate").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写录取率', ok:true,});
			return false;
		}
		if($("#majors_number").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写录取人数', ok:true,});
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<form id="submitForm" name="submitForm" action="../DoMajors?opt=add" method="post">
	<input type="hidden" name="fyID" value="14458625716623" id="fyID"/>
	<div id="container">
		<div id="nav_links">
			当前位置：表单管理&nbsp;>&nbsp;<span style="color: #1A5CC6;">专业管理</span>
			<div id="page_close">
				<a href="javascript:parent.$.fancybox.close();">
					<img src="images/common/page_close.png" width="20" height="20" style="vertical-align: text-top;"/>
				</a>
			</div>
		</div>
		<div class="ui_content">
			<table  cellspacing="0" cellpadding="0" width="100%" align="left" border="0">
				<tr>
					<td class="ui_text_rt" >专业名</td>
					<td class="ui_text_lt">
					<input type="text" id="majors" name="majors" class="ui_input_txt02"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">就业率</td>
					<td class="ui_text_lt">
					<input type="text" id="employement_rate" name="employement_rate" class="ui_input_txt02"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">专业人数</td>
					<td class="ui_text_lt">
					<input type="text" id="majors_number" name="majors_number" class="ui_input_txt02"/>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td class="ui_text_lt">
						&nbsp;<input id="submitbutton" type="submit" value="提交" class="ui_input_btn01"/>
						&nbsp;<input id="cancelbutton" type="button" value="取消" class="ui_input_btn01"/>
					</td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>
</html>